package com.pi.pro.xcmg.am.common;



import com.pi.common.CodesConstants;
import com.pi.common.utils.StringUtils;
import com.pi.pro.xcmg.am.common.vo.report.CommonDocumentDetailsDto;
import com.pi.pro.xcmg.am.common.vo.report.CommonInventoryDetailsDto;
import com.pi.wms.common.WmsConstants;
import org.apache.commons.collections.map.HashedMap;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 常量定义
 */
public class XcmgAmConstants {


    /******************************************************************************************************/
    /**
     * CLIENT/WAS
     * /
     ******************************************************************************************************/
    public final static Long CLIENT_ID_XCMG                                    = 1000100000000L;


    /******************************************************************************************************/
    /**
     * CUSTOMER/WMS
     * /
     ******************************************************************************************************/
    //
    public final static String CUSTOMER_CODE_XCMG_AM                           = "XCMG";
    public final static Long CUSTOMER_ID_XCMG_AM                               = 1000100100010L;
    public final static Long CUSTOMER_ID_WWAREHOUSE_WH101                      = 1000100010010L;


    /******************************************************************************************************/
    /**
     * MATERIAL/WMS
     * /
     ******************************************************************************************************/
    //空托
    public final static Long MATERIAL_ID_EPAL                                  = 1000100100010L;
    //配盘
    public final static Long MATERIAL_ID_KIT                                   = 1000100200010L;
    //自制件
    public final static Long MATERIAL_ID_SELF_MADE                             = 1000100300010L;

    //配盘
    public final static String MATERIAL_CODE_KIT                               = "KA10010";
    //自制件
    public final static String MATERIAL_CODE_SELF_MADE                         = "SM10010";




    /******************************************************************************************************/
    /**
     * MATERIAL_TYPE
     * /
     ******************************************************************************************************/
    public final static String MATERIAL_TYPE_MACHINE                           = "MA";


    //
    public final static String CONTAINER_TYPE_PALLET                           = "1";
    public final static String CONTAINER_TYPE_TOTE                             = "2";






    /******************************************************************************************************/
    /**
     * MATERIAL_GROUP
     * /
     ******************************************************************************************************/
    public final static String MATERIAL_GROUP_METER                            = "METER";

    //
    public final static String SHIP_RULE_WAVE_LOTATTR_ALLOCATOR                = "WAVE_LOTATTR_ALLOCATOR";

    //分配时.严格匹配供应商
    public final static String SHIP_RULE_WAVE_ALLOCATOR_MATCH_SUPPLIER          = CodesConstants.COMMON_FLAG_NO;


    /******************************************************************************************************/
    /**
     * WORK_SOURCE
     * /
     ******************************************************************************************************/
    //采购件
    public final static String WORK_SOURCE_PO                                  = "PO";
    //自制
    public final static String WORK_SOURCE_SELF_MADE                           = "SM";
    //配盘/齐套
    public final static String WORK_SOURCE_KIT                                 = "KIT";
    //其它
    public final static String WORK_SOURCE_OTHER                               = "OT";



    //
    public final static String COUNT_TYPE_NORMAL                               = "NM";


    /******************************************************************************************************/
    /**
     * DIVISION_CODE/WMS
     * /
     ******************************************************************************************************/
    //一期立库
    public final static String DIVISION_WH101_CODE                             = "WH101";
    public final static Long DIVISION_WH101_ID                                 = 1000100010010L;


    //农机编码
    public final static String XCMG_AE_CUSTOMER_CODE                           = "2290";





    /******************************************************************************************************/
    /**
     * ZONE
     * /
     ******************************************************************************************************/


    /******************************************************************************************************/
    /**
     * ZONE_CODE/WORK_MODE
     * /
     ******************************************************************************************************/
    //自动化库区(仓库)
    public final static String ZONE_WORK_MODE_AUTO                             = "AUTO";


    /******************************************************************************************************/
    /**
     * ZONE_CODE/WMS
     * /
     ******************************************************************************************************/
    public final static String ZONE_CODE_HA01                                  = "HA01";
    public final static Long ZONE_ID_HA01                                      = 1000100100050L;

    //库西站台区
    public final static String ZONE_CODE_PA01                                  = "PA01";
    //库东站台区
    public final static String ZONE_CODE_PA02                                  = "PA02";

    /******************************************************************************************************/
    /**
     * LOCATION_CODE/WMS
     * /
    ******************************************************************************************************/
    /**
     *  WH101//站台//库西
      */
    public final static String LOCATION_CODE_PA1005                            = "PA1005";
    public final static String LOCATION_CODE_PA1007                            = "PA1007";
    public final static String LOCATION_CODE_PA1022                            = "PA1022";
    public final static String LOCATION_CODE_PA1027                            = "PA1027";
    public final static String LOCATION_CODE_PA1032                            = "PA1032";
    public final static String LOCATION_CODE_PA1037                            = "PA1037";
    public final static String LOCATION_CODE_PA1043                            = "PA1043";

    //西入库口
    public final static String LOCATION_CODE_PA1042                            = "PA1042";
    public final static String LOCATION_CODE_PA1045                            = "PA1045";

    //东入库口
    public final static String LOCATION_CODE_PA1048                            = "PA1048";
    public final static String LOCATION_CODE_PA1049                            = "PA1049";

    //料箱出库口
    public final static String LOCATION_CODE_PA1054                            = "PA1054";

    //拣货口一 -- 拣货口四
    public final static String LOCATION_CODE_PA1023                            = "PA1023";
    public final static String LOCATION_CODE_PA1028                            = "PA1028";
    public final static String LOCATION_CODE_PA1033                            = "PA1033";
    public final static String LOCATION_CODE_PA1038                            = "PA1038";


    /**
     *  WH101//站台//库东
     */
    public final static String LOCATION_CODE_PA2005                            = "PA2005";
    public final static String LOCATION_CODE_PA2007                            = "PA2007";
    public final static String LOCATION_CODE_PA2022                            = "PA2022";
    public final static String LOCATION_CODE_PA2026                            = "PA2026";
    public final static String LOCATION_CODE_PA2032                            = "PA2032";
    public final static String LOCATION_CODE_PA2037                            = "PA2037";
    public final static String LOCATION_CODE_PA2039                            = "PA2039";

    //拣货口一 -- 拣货口四
    public final static String LOCATION_CODE_PA2023                            = "PA2023";
    public final static String LOCATION_CODE_PA2028                            = "PA2028";
    public final static String LOCATION_CODE_PA2033                            = "PA2033";
    public final static String LOCATION_CODE_PA2038                            = "PA2038";


    /**
     *  WH101//虚拟库位//收货库位
     */
    public final static String LOCATION_CODE_PA0101                            = "PA0101";


    /******************************************************************************************************/
    /**
     * LOCATION_CODE/WAS/WMS
     * /
     ******************************************************************************************************/
    public final static String TASK_ACTION_STORAGE                             ="STORAGE";
    public final static String TASK_ACTION_PALLETIZE                           ="PALLETIZE";



    /******************************************************************************************************/
    /**
     * PRIOR
     * /
     ******************************************************************************************************/
    public final static String PRIOR_HIGH                                      ="0050";
    public final static String PRIOR_LOW                                       ="0300";
    public final static String PRIOR_NORMAL                                    ="0100";



    /******************************************************************************************************/
    /**
     * USER
     * /
     ******************************************************************************************************/
    public final static String WCS_EPAL_REAL_USER                              ="WCS_EPAL_REQ";
    public final static String WCS_EPAL_REPL_USER                              ="WCS_EPAL_REPL";


    //仓库字段
    public final static String DIVISION_ID_FIELD_CODE                          ="division_id";


   /******************************************************************************************************/
   /**
   * LOCATION_CODE/WAS/WMS
   * /
   ******************************************************************************************************/

   //单深位
   //Single_Location
   public final static String PA_CALCULATOR_NAME_SLOC_PA_SEQ_CALCULATOR        ="SLOC_PA_CALCULATOR";



    /******************************************************************************************************/
    /**
     * LED_TYPE
     * /
     ******************************************************************************************************/

    //入库
    public final static String LED_ACTION_TYPE_INBOUND                         ="0";
    //出库
    public final static String LED_ACTION_TYPE_OUTBOUND                        ="1";


    //拣选口显示默认信息
    public final static String LED_BIZ_TYPE_PK_STATION_DEF_INFO                ="1";
    //拣选口显示拣选信息
    public final static String LED_BIZ_TYPE_PK_STATION_PICK_DATA               ="2";
    //拣选失败
    public final static String LED_BIZ_TYPE_PK_STATION_PICK_ERROR              ="3";
    //拣选成功
    public final static String LED_BIZ_TYPE_PK_STATION_PICK_OK                 ="4";
    //入库口显示默认信息
    public final static String LED_BIZ_TYPE_PA_STATION_DEF_INFO                ="1";
    //入库失败
    public final static String LED_BIZ_TYPE_PA_STATION_PA_ERROR                ="3";
    //入库成功
    public final static String LED_BIZ_TYPE_PA_STATION_PA_OK                   ="4";


    //状态/切换
    public final static String LED_STATUS_CODE_1                               ="1";
    public final static String LED_STATUS_CODE_2                               ="2";


    /******************************************************************************************************/
    /** RESULT_CODE
     /******************************************************************************************************/
    //成功
    public final static String RESULT_CODE_EDI_SUCCESS                         = "S";
    public final static String RESULT_CODE_EDI_ERROR                           = "E";
    public final static String RESULT_CODE_EDI_WARN                            = "W";

    public final static String RESULT_CODE_EDI_WARN_GONO                       = "W0100";
    public final static String RESULT_CODE_EDI_WARN_RETRUN                     = "W0200";
    public final static String RESULT_CODE_EDI_WARN_FEEDBACK                   = "W0500"; //WCS自行回退


    //
    public final static int COUNT_MAX_COTAINER_COUNT                           = 200;


    /******************************************************************************************************/
    /** TASK_MODE_RETURN/
     /******************************************************************************************************/
    public final static String TASK_MODE_RETURN_ACTION                         ="CROSS";

    //
    public final static String TASK_MODE_CROSS_ACTION                          ="CROSS_ACTION";



    /******************************************************************************************************/
    /** 跨区拣货
     /******************************************************************************************************/
    //
    //不限制
    public final static String PICK_ZONE_CROSS_CHECK_MODE_ALLOW                ="ALLOW";
    //提示
    public final static String PICK_ZONE_CROSS_CHECK_MODE_WARN                 ="WARN";
    //禁止
    public final static String PICK_ZONE_CROSS_CHECK_MODE_FORBID               ="FORBID";

    //
    public final static String PICK_ZONE_CHECK_MODE                            =PICK_ZONE_CROSS_CHECK_MODE_FORBID;


    /******************************************************************************************************/
    /** 盘点更新(调整)库存
     /******************************************************************************************************/
    //现场盘点更新
    public final static String COUNT_TRANSFER_MODE_COUNT_MAKE_CHANGE           ="LIVE";
    //整单审核发布（更新)
    public final static String COUNT_TRANSFER_MODE_DOCUMENT_DELIVEY            ="DELIVEY";
    //手动更新
    public final static String COUNT_TRANSFER_MODE_MANUAL_CHANGE               ="MANUAL";
    //盘点调整模式
    public final static String COUNT_TRANSFER_MODE                             =COUNT_TRANSFER_MODE_COUNT_MAKE_CHANGE;





    /******************************************************************************************************/
    /** LABEL
     /******************************************************************************************************/
    public final static String openPickLabelPrint                              = CodesConstants.COMMON_FLAG_YES;
    public final static Long PRINT_TEMPLATE_ID_PICK_LABEL                      = 1000100310010L;
    public final static String PRINT_PICK_LABEL_A001_8_8_DEF_PRINTER           ="";






    /******************************************************************************************************/
    /**
     * PROGRAM
     * /
     ******************************************************************************************************/
    public static final String HTTP_CONTENT_TYPE_HTTP_JSON                     = "application/json";



/******************************************************************************************************/
/** organization/division/VIEW
 /******************************************************************************************************/
    public static final Map<Long, String> clients                              = new HashMap<>();
    public static final Map<Long, String> organizations                        = new HashMap<>();



/******************************************************************************************************/
/** LOCATION
 /******************************************************************************************************/


    /******************************************************************************************************/
    /** organization/division/VIEW
     /******************************************************************************************************/
    public static final Map<String, String> asnStatus                               = new HashMap<>();
    public static final Map<String, String> soStatus                                = new HashMap<>();
    public static final Map<String, String> storageStatus                           = new HashMap<>();


    /******************************************************************************************************/
    /**
     * CACHE
     * /
     ******************************************************************************************************/
    public static Map<String, Long> divisionCodeIdMapping                      = new HashMap<>();
    public static Map<Long, String> divisionIdCodeMapping                      = new HashMap<>();
    public static Map<String, String> wcsWasLocationMapping                    = new HashMap<>();

    public static Map<String, BigDecimal> locationHeightMapping                = new HashMap<>();
    public static Map<String, BigDecimal> locationLengthMapping                = new HashMap<>();

    public static List<Long> storageZoneIds                                    = new ArrayList<>();
    public static List<Long> asrsZoneIds                                       = new ArrayList<>();
    public static Map<Long, String> divisionBinLocationPrefix                  = new HashMap<>();

    //码盘入库申请
    public final static Map<String, String> wh101PalletizeReqStations          = new HashMap<>();
    //拣货站台
    public final static Map<String, String> wh101ShipCloseStations             = new HashMap<>();
    //请求入库
    public final static Map<String, String> wh101MoveinReqStations             = new HashMap<>();
    //Epal入库请求
    public final static Map<String, String> wh101EpalReqStations               = new HashMap<>();

    //SRM卸载站台/环线站台
    public final static Map<String, String> wh101SrmDropStations               = new HashMap<>();
    //Epal补充
    public final static Map<String, String> wh101EpalReplStations              = new HashMap<>();
    //
    public final static Map<String, String> wh101MoveCloseStations             = new HashedMap();
    //
    public final static Map<String, String> srmDropStationMap                  = new HashMap<>();

    public final static Map<String, String> srmPickstationMap                  = new HashMap<>();


    Map<String, String> pickzones=new HashMap<>();

    //public final static String wh101EpalReplStationOptions = "1052,1053,1054";
    public final static String wh101EpalReplStationOptions                     = "1054";

    public final static Map<Long, Integer> epalReplBufSizes                    = new HashedMap();

    public final static Map<String, String> retrunLocationMap                  = new HashedMap();
    //
    public final static Map<String, String> onlinePickZoneMap                  = new HashMap<>();


    public final static Map<String, String> wh101LedLocations                 = new HashedMap();

    /******************************************************************************************************/
    /**
     * organization/division/VIEW
     * /
     ******************************************************************************************************/

    static {
        clients.put(CLIENT_ID_XCMG, CUSTOMER_CODE_XCMG_AM);
        organizations.put(CUSTOMER_ID_WWAREHOUSE_WH101, DIVISION_WH101_CODE);

        //
        divisionCodeIdMapping.put(DIVISION_WH101_CODE, DIVISION_WH101_ID);
        divisionIdCodeMapping.put(DIVISION_WH101_ID, DIVISION_WH101_CODE);

        //
        storageZoneIds.add(ZONE_ID_HA01);

        //
        asrsZoneIds.add(ZONE_ID_HA01);

        //
        divisionBinLocationPrefix.put(DIVISION_WH101_ID, "RA");

        //
        /**
        locationHeightMapping.put(PALLET_HEIGHT_TYPE_00_CODE, PALLET_HEIGHT_TYPE_00_VALUE);
        locationHeightMapping.put(PALLET_HEIGHT_TYPE_01_CODE, PALLET_HEIGHT_TYPE_01_VALUE);
        locationHeightMapping.put(PALLET_HEIGHT_TYPE_02_CODE, PALLET_HEIGHT_TYPE_02_VALUE);

        locationLengthMapping.put(PALLET_LEN_TYPE_00_CODE, PALLET_LEN_TYPE_00_VALUE);
        locationLengthMapping.put(PALLET_LEN_TYPE_01_CODE, PALLET_LEN_TYPE_01_VALUE);
        locationLengthMapping.put(PALLET_LEN_TYPE_02_CODE, PALLET_LEN_TYPE_02_VALUE);
        **/


        //PAL-RECV-REQ
        wh101PalletizeReqStations.put(LOCATION_CODE_PA1042, ZONE_CODE_PA01);
        wh101PalletizeReqStations.put(LOCATION_CODE_PA1048, ZONE_CODE_PA01);

        //SHIP-CLOSE
        wh101ShipCloseStations.put(LOCATION_CODE_PA1023, ZONE_CODE_PA01);
        wh101ShipCloseStations.put(LOCATION_CODE_PA1028, ZONE_CODE_PA01);
        wh101ShipCloseStations.put(LOCATION_CODE_PA1033, ZONE_CODE_PA01);
        wh101ShipCloseStations.put(LOCATION_CODE_PA1038, ZONE_CODE_PA01);

        wh101ShipCloseStations.put(LOCATION_CODE_PA2023, ZONE_CODE_PA02);
        wh101ShipCloseStations.put(LOCATION_CODE_PA2028, ZONE_CODE_PA02);
        wh101ShipCloseStations.put(LOCATION_CODE_PA2033, ZONE_CODE_PA02);
        wh101ShipCloseStations.put(LOCATION_CODE_PA2038, ZONE_CODE_PA02);

        //MOVEIN-REQ
        wh101MoveinReqStations.put(LOCATION_CODE_PA1023, ZONE_CODE_PA01);
        wh101MoveinReqStations.put(LOCATION_CODE_PA1028, ZONE_CODE_PA01);
        wh101MoveinReqStations.put(LOCATION_CODE_PA1033, ZONE_CODE_PA01);
        wh101MoveinReqStations.put(LOCATION_CODE_PA1038, ZONE_CODE_PA01);

        wh101MoveinReqStations.put(LOCATION_CODE_PA2023, ZONE_CODE_PA02);
        wh101MoveinReqStations.put(LOCATION_CODE_PA2028, ZONE_CODE_PA02);
        wh101MoveinReqStations.put(LOCATION_CODE_PA2033, ZONE_CODE_PA02);
        wh101MoveinReqStations.put(LOCATION_CODE_PA2038, ZONE_CODE_PA02);

        //EPAL-MOVEIN-REQ
        wh101EpalReqStations.put(LOCATION_CODE_PA1049, ZONE_CODE_PA01);

        //SRM-DROP/outbound
        wh101SrmDropStations.put(LOCATION_CODE_PA1005, ZONE_CODE_PA01);
        wh101SrmDropStations.put(LOCATION_CODE_PA1007, ZONE_CODE_PA01);
        wh101SrmDropStations.put(LOCATION_CODE_PA2005, ZONE_CODE_PA02);
        wh101SrmDropStations.put(LOCATION_CODE_PA2007, ZONE_CODE_PA02);

        //EPAL-REPL
        wh101EpalReplStations.put(LOCATION_CODE_PA1054, ZONE_CODE_PA01);

        //
        wh101MoveCloseStations.putAll(wh101MoveinReqStations);
        wh101MoveCloseStations.putAll(wh101EpalReplStations);
        wh101MoveCloseStations.put(LOCATION_CODE_PA1043, ZONE_CODE_PA01);
        wh101MoveCloseStations.put(LOCATION_CODE_PA2039, ZONE_CODE_PA02);
        wh101MoveCloseStations.put(LOCATION_CODE_PA1045, ZONE_CODE_PA01);
        wh101MoveCloseStations.put(LOCATION_CODE_PA1049, ZONE_CODE_PA01);

        //
        srmDropStationMap.put(DIVISION_WH101_CODE+"/"+"R001"+"/"+ZONE_CODE_PA01, LOCATION_CODE_PA1005);
        srmDropStationMap.put(DIVISION_WH101_CODE+"/"+"R002"+"/"+ZONE_CODE_PA01, LOCATION_CODE_PA1007);

        srmDropStationMap.put(DIVISION_WH101_CODE+"/"+"R001"+"/"+ZONE_CODE_PA02, LOCATION_CODE_PA2005);
        srmDropStationMap.put(DIVISION_WH101_CODE+"/"+"R002"+"/"+ZONE_CODE_PA02, LOCATION_CODE_PA2007);

        epalReplBufSizes.put(DIVISION_WH101_ID, 3);

        retrunLocationMap.put(LOCATION_CODE_PA1042, LOCATION_CODE_PA1045);
        retrunLocationMap.put(LOCATION_CODE_PA1048, LOCATION_CODE_PA1049);

        onlinePickZoneMap.put(XcmgAmConstants.ZONE_CODE_PA01, CodesConstants.COMMON_FLAG_YES);
        onlinePickZoneMap.put(XcmgAmConstants.ZONE_CODE_PA02, CodesConstants.COMMON_FLAG_YES);


        //
        wh101LedLocations.put(LOCATION_CODE_PA1023, ZONE_CODE_PA01);
        wh101LedLocations.put(LOCATION_CODE_PA1028, ZONE_CODE_PA01);
        wh101LedLocations.put(LOCATION_CODE_PA1033, ZONE_CODE_PA01);
        wh101LedLocations.put(LOCATION_CODE_PA1038, ZONE_CODE_PA01);

        wh101LedLocations.put(LOCATION_CODE_PA2023, ZONE_CODE_PA02);
        wh101LedLocations.put(LOCATION_CODE_PA2028, ZONE_CODE_PA02);
        wh101LedLocations.put(LOCATION_CODE_PA2033, ZONE_CODE_PA02);
        wh101LedLocations.put(LOCATION_CODE_PA2038, ZONE_CODE_PA02);

        wh101LedLocations.put(LOCATION_CODE_PA1045, ZONE_CODE_PA01);
        wh101LedLocations.put(LOCATION_CODE_PA1049, ZONE_CODE_PA01);
    }


}
